import tkinter
import windnd
from tkinter.messagebox import showinfo


def dragged_files(files):
    msg = '\n'.join((item.decode('gbk') for item in files))
    flag = msg.endswith(".mp4")
    if flag:
        showinfo("提示", "好的，处理中...")
    else:
        showinfo("提示", "请拖入mp4格式的视频文件")


top = tkinter.Tk()
top.title('流调监控工具')
top.geometry('500x500')
text = tkinter.Label(top, text="欢迎使用流调监控工具", fg="red", font=('Times', 20, 'bold italic'))
text1 = tkinter.Label(top, text="请将需要分析的视频拖入至窗口中", fg="red", font=('Times', 20, 'bold italic'))
# /n
# 将文本内容放置在主窗口内
text.pack()
text1.pack()
windnd.hook_dropfiles(top, func=dragged_files)

# 进入消息循环
top.mainloop()
